#include <iostream>
#include <filesystem>
#include <string>

namespace fs = std::filesystem;

int main()
{
    std::string parent_dir_string;
    std::cout << "请输入父目录的路径: " << std::endl;
    std::getline(std::cin, parent_dir_string);
    fs::path parent_path = parent_dir_string;

    std::string relative_path_string;
    std::cout << "请输入要创建的相对路径（相对于父目录，例如: new_dir/sub_dir）：" << std::endl;
    std::getline(std::cin, relative_path_string);
    fs::path relative_path = relative_path_string;

    fs::path full_path = parent_path / relative_path;

    std::error_code ec;
    if (fs::create_directories(full_path, ec))
    {
        std::cout << "成功在 " << parent_path << " 下创建目录: " << relative_path << std::endl;
    }
    else if (ec)
    {
        std::cerr << "创建目录失败: " << ec.message() << std::endl;
    }
    else
    {
        std::cout << "目录已存在或创建成功。" << std::endl;
    }

    return 0;
}